﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TimViec
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                if(Session["NTD"] !=null)
                {
                    Response.Redirect("/nha-tuyen-dung/index.html");
                }
            }
        }

        protected void btLogin_Click(object sender, EventArgs e)
        {
            if (BLL.TuyenDung.UserHelper.Login(txtUserName.Text, txtPass.Text))
            {
                Session["NTD"] = txtUserName.Text;
                Response.Redirect("/nha-tuyen-dung/tai-khoan.html");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirectMe", "alert('Sai tên đăng nhập hoặc mật khẩu!');", true);
                return;
            }
        }
    }
}